<?php


namespace app\admin\controller;


use think\Controller;
use think\Db;


class ComplaintController extends Controller
{
    public function index()
    {
        $data=Db::table('sa_complaint')->select();
        $this->assign('list',$data);
        return $this->fetch();
    }

    public function complaint_reply()
    {
        $id = intval($_GET['id']);
        $this->assign('id',$id);
        return $this->fetch('reply');
    }

    public function reply_do()
    {
        $id =    intval($_POST['id']);
        $reply = $this->request->param('content');
        $data = [
            'reply'  => $reply,
            'id'     => $id
        ];
        Db::name('complaint')->update($data);
        return $this->success('回复成功','complaint/index');

    }
}